package SeparateWriter;

import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.io.PrintWriter;
import java.text.DecimalFormat;

/**
 * User: Mike
 * Date: 10/29/11
 */
public class Writer {

    static void WriteData(String lineToWrite, String fileNamePath) throws IOException {
        System.out.println("finally.. writing the data");
        String Dir = fileNamePath;  //"C:\\WhiskeyData\\output.txt";
        DecimalFormat df1 = new DecimalFormat("###.##");
        FileWriter write = new FileWriter(Dir, false);
        PrintWriter text = new PrintWriter(write, false);           // i think false overwrites the file
        File txtFile = new File(fileNamePath);
        System.out.println(lineToWrite);
        text.println(lineToWrite);
        text.flush();
        write.close();
        text.close();
        write = null;
        text = null;
    }
}
